<template>
  <el-dropdown style="float: right">
  <span class="el-dropdown-link">
    {{ user.username }}<i class="el-icon-arrow-down el-icon--right"></i>
  </span>
    <el-dropdown-menu slot="dropdown">
      <el-dropdown-item @click.native="zhuxiao">注销</el-dropdown-item>
      <el-dropdown-item @click.native="geren">个人信息</el-dropdown-item>
    </el-dropdown-menu>
  </el-dropdown>
</template>

<script>

export default {
  name: "Header",
  computed: {
  },
  data(){
    return{
      user:[]
    }
  },
  methods:{
    zhuxiao(){
      this.$router.push("/")
      sessionStorage.removeItem("user")
      },
    geren(){
      this.$router.push("/my")
    },
    },
  mounted(){
    this.user=JSON.parse(window.sessionStorage.getItem("user"))
  },
}
</script>

<style scoped>
.el-dropdown-link {
  cursor: pointer;
  color: #409EFF;
}
.el-icon-arrow-down {
  font-size: 12px;
}
</style>